home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / NOVELL.INC < prev    next >
Text File  |  1993-05-18  |  7KB  |  277 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file exports definitions that create a Novell menu look and
  5. feel. This is one of several look and feel files that export the same
  6. procedures.
  7.  
  8. Useful Routines Exported:
  9.  
  10. LookSetup
  11.    Call this to initialize the screen. Set MenuTitle and StatusLineText
  12.    before calling this routine.
  13.  
  14. CornerStretchBox (Header,Col,Row)
  15.    Creates a window from the array Choices with the upper left corner at
  16.    Row/Col. LastKey is set to the letter that is chosen.
  17.  
  18. CenterStretchBox (Header,Col,Row)
  19.    Creates a window from the array Choices with the center at Row/Col.
  20.    if a 0 is passed for either the Row or Col then the center of the
  21.    screen is assumed. LastKey is set to the letter that is chosen.
  22.  
  23. Leave
  24.    Puts up an exit box.
  25.  
  26.  
  27. ==========================================================
  28. EndComment
  29.  
  30.  
  31. var
  32.   Choices
  33.   MenuTitle
  34.   StatusLineText
  35.   StatusWindow
  36.   HeightDifference
  37.   Greek = False
  38.  
  39. var
  40.   BackGroundFG
  41.   BackGroundBG
  42.   TitleBoxBorderFG
  43.   TitleBoxBG
  44.   TitleBoxInsideFG
  45.   ClockColorFG
  46.   StatusLineFG
  47.   StatusLineBG
  48.   MenuInsideFG
  49.   MenuBG
  50.   MenuHeaderFG
  51.   MenuBorderFG
  52.   MenuVertLinesFG
  53.   MenuInverseFG
  54.   MenuInverseBG
  55.   MenuCapColorFG
  56.   ConsoleInsideFG
  57.   GreekFG
  58.   GreekBG
  59.  
  60. ;------ This is where you set your favorite colors.
  61.  
  62. Procedure SetColors
  63.    if ColorScreen
  64.       BackGroundFG     = Grey
  65.       BackGroundBG     = Blue
  66.       TitleBoxBG       = Brown
  67.       TitleBoxBorderFG = White
  68.       TitleBoxInsideFG = Yellow
  69.       ClockColorFG     = Yellow
  70.       StatusLineFG     = Yellow
  71.       StatusLineBG     = Mag
  72.       MenuBG           = Blue
  73.       MenuInsideFG     = Yellow
  74.       MenuBorderFG     = Yellow
  75.       MenuHeaderFG     = LCyan
  76.       MenuVertLinesFG  = LGreen
  77.       MenuInverseFG    = White
  78.       MenuInverseBG    = Mag
  79.       MenuCapColorFG   = White
  80.       ConsoleInsideFG  = White
  81.       GreekFG          = Blue
  82.       GreekBG          = Green
  83.       BoxHeaderColor Yellow Green
  84.    else
  85.       BackGroundFG     = Grey
  86.       BackGroundBG     = Black
  87.       TitleBoxBG       = Grey
  88.       TitleBoxBorderFG = Black
  89.       TitleBoxInsideFG = Black
  90.       ClockColorFG     = Black
  91.       StatusLineFG     = Black
  92.       StatusLineBG     = Grey
  93.       MenuBG           = Black
  94.       MenuInsideFG     = Grey
  95.       MenuBorderFG     = Grey
  96.       MenuHeaderFG     = White
  97.       MenuVertLinesFG  = White
  98.       MenuInverseFG    = Black
  99.       MenuInverseBG    = Grey
  100.       MenuCapColorFG   = White
  101.       ConsoleInsideFG  = Grey
  102.       GreekFG          = Black
  103.       GreekBG          = Grey
  104.       BoxHeaderColor Black Grey
  105.    endif
  106. EndProc
  107.  
  108. ;------ Sets up main window to Novell look.
  109.  
  110. Procedure LookSetup
  111.    if MenuInsideFG = 0 then SetColors
  112.    NoExit
  113.  
  114.    ;------ Clear the screen with a textured background
  115.  
  116.    if not Overlayed
  117.       TextColor BackGroundFG BackGroundBG
  118.       ClearScreen 176
  119.  
  120.       ;------ If Greek is true then draw greek columns
  121.  
  122.       if Greek then GreekColumns
  123.    endif
  124.  
  125.    ;------ Draw Status Line
  126.  
  127.    NoBoxBorder
  128.    InactiveBox NoBoxBorder
  129.    Explode Off
  130.    BoxInsideColor StatusLineFG StatusLineBG
  131.    DrawBox 1 ScreenHeight ScreenWidth 1
  132.    StatusWindow = CurrentWindow
  133.    WriteCenter(StatusLineText)
  134.  
  135.    if not Overlayed
  136.  
  137.       ;------ Draw the Title Box
  138.  
  139.       SingleLineBox
  140.       BoxInsideColor TitleBoxInsideFG TitleBoxBG
  141.       BoxBorderColor TitleBoxBorderFG TitleBoxBG
  142.       DrawBox 1 1 ScreenWidth 3
  143.       GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)
  144.       Write MenuTitle
  145.  
  146.       ;------ Display the clock
  147.  
  148.       ClockColor ClockColorFG TitleBoxBG
  149.       ClockPos 3 2
  150.  
  151.       ;------ Setup Console
  152.  
  153.       ConsolePos 42 5
  154.       ConsoleHeaderColor MenuInverseFG MenuInverseBG
  155.       ConsoleInsideColor ConsoleInsideFG MenuBG
  156.  
  157.    endif
  158.    HeightDifference = 4
  159. EndProc
  160.  
  161.  
  162. Procedure MakeBox(Header,Col,Row,Center)
  163. var NumElem Height Width Cnt
  164.  
  165.    Width = Length(Header) - 1
  166.    NumElem = NumberOfElements(Choices)
  167.  
  168.      ;Get the widest element in the Choices Array
  169.  
  170.    if Length(Choices[1]) > 0
  171.       Cnt = 65
  172.       loop NumElem
  173.          Trim(Choices[LoopIndex])
  174.          if left(Choices[LoopIndex],1) <> '─'
  175.             Choices[LoopIndex] = " " + Char(Cnt) + ". " + Choices[LoopIndex]
  176.             Cnt = Cnt + 1
  177.          endif
  178.          Width = Max(Width,Length(Choices[LoopIndex]))
  179.       endloop
  180.    else
  181.       Width = ScreenWidth - 7
  182.    endif
  183.    Height = NumElem + 2
  184.    if Header > '' then Height = NumElem + 4
  185.    Width = Width + 5
  186.    if Center
  187.       if Row = 0
  188.  
  189.          ;Center window verticaly
  190.  
  191.          Row = ((ScreenHeight - Height) / 2) + 2
  192.       else
  193.  
  194.          ;Center window with X Coordinate
  195.  
  196.          Row = (Row - (Height / 2) + 1)
  197.       endif
  198.       if Col = 0
  199.  
  200.          ;Center window horizonitly
  201.  
  202.          Col = (ScreenWidth - Width) / 2 + 1
  203.       else
  204.  
  205.          ;Center window with Y Coordinate
  206.  
  207.          Col = (Col - (Width / 2) + 1)
  208.       endif
  209.    endif
  210.  
  211.    ;Make Sure Row and Col are within their range
  212.  
  213.    Row = Max(Row,5)
  214.    Row = Min(Row,ScreenHeight - Height - 1)
  215.    Col = Max(Col,2)
  216.    Col = Min(Col,ScreenWidth - Width)
  217.  
  218.    DrawTheBox(Col,Row,Width,Height,Header)
  219.  
  220.      ;Write the menu choices
  221.  
  222.    loop(NumElem - 1)
  223.       if left(Choices[LoopIndex],1) = '─'
  224.          TextColor MenuVertLinesFG MenuBG
  225.          ClearLine 196
  226.          TextColor MenuInsideFG MenuBG
  227.          CapsColor(MenuCapColorFG,MenuBG)
  228.          Writeln
  229.       else
  230.          Writeln(Choices[LoopIndex])
  231.       endif
  232.    endloop
  233.  
  234.    Write Choices[NumElem]
  235.    UseArrows On
  236.    Dispose(Choices)
  237. EndProc
  238.  
  239. ;------ Draw the Box
  240.  
  241. Procedure DrawTheBox (Col,Row,Width,Height,Header)
  242.  
  243.      ;Draw the main window
  244.  
  245.    DoubleLineBox
  246.    InactiveBox SingleLineBox
  247.    BoxInsideColor(MenuInsideFG,MenuBG)
  248.    BoxBorderColor(MenuBorderFG,MenuBG)
  249.    DrawBox(Col, Row, Width, Height)
  250.  
  251.    if Header > ''
  252.  
  253.      ;Write the header
  254.  
  255.       TextColor(MenuHeaderFG,MenuBG)
  256.       WriteCenter(Header)
  257.  
  258.      ;Write the vertical lines
  259.  
  260.       TextColor(MenuVertLinesFG,MenuBG)
  261.       Writeln
  262.       ClearLine 196
  263.       GotoXY 2 2
  264.       WriteVertical mid(VertLine,1,Height - 3)
  265.  
  266.      ;Draw the menu text box
  267.  
  268.       CapsColor(MenuCapColorFG,MenuBG)
  269.       InverseColor(MenuInverseFG,MenuInverseBG)
  270.       Window(Col + 3, Row + 3, Width - 4, Height - 4)
  271.    else
  272.       CapsColor Black Black
  273.    endif
  274. EndProc
  275.  
  276.  
  277.